![]() |
PATH![]() |
![]() ![]() |
The Every Element reference form specifies every object of a particular class in a container.
every className
pluralClassName
className is a singular class name (such as word or paragraph).
pluralClassName is the plural form (such as words or paragraphs ) defined by AppleScript or an application. The plural form of an object class name has the same effect as the word every before an object class name. Plural forms are listed in application dictionaries.
The value of an Every Element reference is a list of the objects in the container. If the container does not contain any objects of the specified class, the list is an empty list. For example, the value of the expression
every word of {1, 2, 3}
{}
The following example assigns a string to the variable myString , and then uses the Every Element reference form to specify every word contained in the string.
set myString to "That's all, folks"
every word of myString
The value of the reference every word of myString is a list with three items:
{"That's", "all", "folks"}
The following reference specifies the same list:
words of myString
The following example specifies a list of all the files in the Control Panels folder.
tell application "Finder"
every file in control panels folder
end tell
The following specifies the same list as the previous example.
tell application "Finder"
files in control panels folder
end tell
If you specify an Every Element reference as the container for a property or object, the result is a list containing the specified property or object for each object of the container. The number of items in the list is the same as the number of objects in the container. For example, the value of the reference
length of every word
{ 2, 3, 6 }
The first item in the list is the length of the first word, the second item is the length of the second word, and so on.